/**
 * Styles for Parallel Analysis Component
 */

.parallel-analysis {
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin: 20px 0;
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.analysis-header h2 {
  margin: 0;
  color: var(--text-primary);
}

.view-mode-selector {
  display: flex;
  gap: 10px;
}

.view-mode-selector button {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.view-mode-selector button:hover {
  background: var(--bg-hover);
}

.view-mode-selector button.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-primary);
  padding: 15px;
  border-radius: 6px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.stat-card.warning {
  border-color: var(--warning-color);
  background: var(--warning-bg);
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* Groups Container */
.groups-container {
  display: grid;
  gap: 15px;
}

.group-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-left-width: 4px;
  border-radius: 6px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.2s;
}

.group-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.group-card.selected {
  background: var(--bg-selected);
  border-color: var(--primary-color);
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.group-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-primary);
}

.risk-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.risk-badge.low {
  background: #10b98120;
  color: #10b981;
}

.risk-badge.medium {
  background: #f59e0b20;
  color: #f59e0b;
}

.risk-badge.high {
  background: #ef444420;
  color: #ef4444;
}

.group-info {
  color: var(--text-secondary);
}

.group-reason {
  margin: 10px 0;
  font-style: italic;
}

.group-tasks {
  margin: 10px 0;
  font-size: 14px;
}

.group-confidence {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.confidence-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: var(--success-color);
  transition: width 0.3s;
}

/* Task List */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.task-id {
  font-weight: bold;
  color: var(--primary-color);
  min-width: 40px;
}

.task-desc {
  flex: 1;
  color: var(--text-primary);
}

.parallel-badge {
  padding: 4px 8px;
  background: var(--success-bg);
  color: var(--success-color);
  border-radius: 4px;
  font-size: 12px;
}

/* Warnings */
.warnings-container {
  margin-top: 20px;
  padding: 15px;
  background: var(--warning-bg);
  border: 1px solid var(--warning-color);
  border-radius: 6px;
}

.warnings-container h3 {
  margin: 0 0 10px 0;
  color: var(--warning-color);
  font-size: 16px;
}

.warnings-list {
  margin: 0;
  padding-left: 20px;
}

.warning-item {
  color: var(--text-secondary);
  margin: 5px 0;
}

/* Progress */
.progress-container {
  padding: 40px;
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 15px;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s;
}

.progress-message {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Actions */
.analysis-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

/* Empty State */
.parallel-analysis.empty {
  padding: 60px;
  text-align: center;
  color: var(--text-secondary);
}

.parallel-analysis.loading {
  padding: 60px;
}

/* Graph Placeholder */
.graph-placeholder {
  padding: 80px;
  text-align: center;
  background: var(--bg-primary);
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
}

/* Smart Suggestions Styles */
.smart-suggestions {
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.suggestions-header {
  margin-bottom: 20px;
}

.suggestions-intro {
  color: var(--text-secondary);
  font-size: 14px;
}

.suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.suggestion-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-left-width: 4px;
  border-radius: 6px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.suggestion-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.suggestion-card.selected {
  background: var(--bg-selected);
}

.suggestion-card.applied {
  opacity: 0.7;
  border-left-color: var(--success-color) !important;
}

.suggestion-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.suggestion-icon {
  font-size: 24px;
}

.suggestion-title {
  flex: 1;
  margin: 0;
  font-size: 18px;
  color: var(--text-primary);
}

.suggestion-confidence {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.confidence-meter {
  width: 100px;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s;
}

.confidence-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.suggestion-description {
  color: var(--text-secondary);
  margin: 10px 0;
}

.suggestion-details {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.detail-section {
  margin-bottom: 15px;
}

.detail-section h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--text-primary);
}

.detail-section ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
}

.detail-section li {
  margin: 4px 0;
  font-size: 14px;
}

.suggestion-recommendation {
  padding: 10px;
  background: var(--bg-secondary);
  border-radius: 4px;
  font-size: 14px;
  color: var(--text-primary);
  margin: 15px 0;
}

.suggestion-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 15px;
}

.applied-badge {
  padding: 8px 16px;
  background: var(--success-bg);
  color: var(--success-color);
  border-radius: 4px;
  font-weight: 500;
}

.mode-hint {
  padding: 8px;
  color: var(--text-secondary);
  font-size: 14px;
  font-style: italic;
}

.suggestions-footer {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.suggestions-note {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 0;
}

.smart-suggestions.loading,
.smart-suggestions.empty {
  padding: 60px;
  text-align: center;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 20px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Tab Styles */
.parallel-analysis-tab {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.tab-header {
  margin-bottom: 30px;
}

.tab-header h1 {
  margin: 0 0 10px 0;
  color: var(--text-primary);
}

.tab-description {
  color: var(--text-secondary);
  font-size: 16px;
}

.execution-mode-panel {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.execution-mode-panel h3 {
  margin: 0 0 15px 0;
  color: var(--text-primary);
}

.mode-selector {
  display: flex;
  gap: 20px;
}

.mode-option {
  flex: 1;
  padding: 15px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.mode-option:hover {
  border-color: var(--primary-color);
}

.mode-option.active {
  border-color: var(--primary-color);
  background: var(--bg-selected);
}

.mode-option input[type="radio"] {
  margin-right: 10px;
}

.mode-label {
  display: flex;
  flex-direction: column;
}

.mode-label strong {
  color: var(--text-primary);
  margin-bottom: 4px;
}

.mode-label small {
  color: var(--text-secondary);
  font-size: 12px;
}

.turbo-settings {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.setting-row label {
  color: var(--text-primary);
}

.setting-row input[type="number"] {
  width: 60px;
  padding: 5px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.setting-hint {
  color: var(--text-secondary);
  font-size: 12px;
}

.analysis-sections {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.analysis-section {
  background: var(--bg-primary);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.analysis-section h2 {
  margin: 0 0 20px 0;
  color: var(--text-primary);
}

.ccpm-analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ccpm-analysis-results {
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 6px;
}

.ccpm-summary h4,
.ccpm-agents h4,
.ccpm-recommendations h4,
.ccpm-issues h4 {
  margin: 0 0 10px 0;
  color: var(--text-primary);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 10px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  background: var(--bg-primary);
  border-radius: 4px;
}

.summary-label {
  color: var(--text-secondary);
  font-size: 14px;
}

.summary-value {
  font-weight: bold;
  color: var(--text-primary);
}

.ccpm-agents,
.ccpm-recommendations,
.ccpm-issues {
  margin-top: 20px;
}

.ccpm-error {
  padding: 20px;
  background: var(--error-bg);
  border: 1px solid var(--error-color);
  border-radius: 6px;
  color: var(--error-color);
}

.error-message {
  margin-top: 10px;
  color: var(--text-secondary);
}

.tab-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.phase-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.phase-badge {
  padding: 6px 12px;
  background: var(--primary-color);
  color: white;
  border-radius: 4px;
  font-weight: 500;
  font-size: 14px;
}

.phase-description {
  color: var(--text-secondary);
  font-size: 14px;
}

/* CSS Variables (add to main theme) */
:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --success-color: #10b981;
  --success-bg: #10b98120;
  --warning-color: #f59e0b;
  --warning-bg: #f59e0b10;
  --bg-primary: #ffffff;
  --bg-secondary: #f3f4f6;
  --bg-hover: #f9fafb;
  --bg-selected: #eff6ff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
}

/* Execution Monitor Styles */
.execution-monitor {
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin: 20px 0;
}

.monitor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.monitor-header h2 {
  margin: 0;
  color: var(--text-primary);
}

.monitor-controls {
  display: flex;
  gap: 10px;
}

.btn-danger {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  background: #ef4444;
  color: white;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

/* Execution Progress */
.execution-progress {
  background: var(--bg-primary);
  padding: 20px;
  border-radius: 6px;
  margin-bottom: 30px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.progress-header h3 {
  margin: 0;
  color: var(--text-primary);
}

.progress-percentage {
  font-size: 18px;
  font-weight: bold;
  color: var(--primary-color);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 15px;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s;
}

.progress-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.stat-value {
  font-size: 16px;
  font-weight: bold;
  color: var(--text-primary);
}

.stat-value.running {
  color: var(--primary-color);
}

.stat-value.completed {
  color: var(--success-color);
}

.stat-value.failed {
  color: #ef4444;
}

/* Task Status List */
.task-status-list {
  background: var(--bg-primary);
  padding: 20px;
  border-radius: 6px;
  margin-bottom: 30px;
}

.task-status-list h3 {
  margin: 0 0 20px 0;
  color: var(--text-primary);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-status-item {
  padding: 15px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.task-status-item:hover {
  background: var(--bg-hover);
}

.task-status-item.selected {
  background: var(--bg-selected);
  border-color: var(--primary-color);
}

.task-status-header {
  display: flex;
  align-items: center;
  gap: 15px;
}

.task-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.task-id {
  font-weight: bold;
  color: var(--primary-color);
  min-width: 60px;
}

.task-state {
  text-transform: capitalize;
  font-weight: 500;
  min-width: 80px;
}

.task-duration {
  color: var(--text-secondary);
  font-size: 14px;
  margin-left: auto;
}

.task-progress {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}

.task-progress-fill {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s;
}

.task-progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 35px;
}

.task-details {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}

.task-dependencies,
.task-dependents {
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.task-output,
.task-error {
  margin-top: 10px;
}

.task-output pre,
.task-error pre {
  background: var(--bg-primary);
  padding: 10px;
  border-radius: 4px;
  font-size: 12px;
  overflow-x: auto;
  margin: 5px 0 0 0;
  white-space: pre-wrap;
}

.error-text {
  color: #ef4444;
}

/* Execution Results */
.execution-results {
  background: var(--bg-primary);
  padding: 20px;
  border-radius: 6px;
  margin-bottom: 30px;
}

.execution-results h3 {
  margin: 0 0 15px 0;
  color: var(--text-primary);
}

.results-summary {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding: 10px;
  background: var(--bg-secondary);
  border-radius: 4px;
}

.results-stat {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.results-stat.success {
  color: var(--success-color);
}

.results-stat.failed {
  color: #ef4444;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-item {
  padding: 15px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left-width: 4px;
  border-radius: 4px;
}

.result-item.success {
  border-left-color: var(--success-color);
}

.result-item.failed {
  border-left-color: #ef4444;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 10px;
}

.result-icon {
  font-size: 16px;
}

.result-task-id {
  font-weight: bold;
  color: var(--primary-color);
}

.result-duration {
  color: var(--text-secondary);
  font-size: 14px;
  margin-left: auto;
}

.result-output,
.result-error {
  margin-top: 10px;
}

.result-output pre,
.result-error pre {
  background: var(--bg-primary);
  padding: 10px;
  border-radius: 4px;
  font-size: 12px;
  overflow-x: auto;
  margin: 0;
  white-space: pre-wrap;
}

/* Rollback Points */
.rollback-points {
  background: var(--bg-primary);
  padding: 20px;
  border-radius: 6px;
  margin-bottom: 30px;
}

.rollback-points h3 {
  margin: 0 0 20px 0;
  color: var(--text-primary);
}

.rollback-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rollback-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.rollback-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rollback-description {
  color: var(--text-primary);
  font-weight: 500;
}

.rollback-timestamp {
  color: var(--text-secondary);
  font-size: 12px;
}

/* Monitor Empty State */
.monitor-empty {
  padding: 60px;
  text-align: center;
  color: var(--text-secondary);
}

.monitor-empty p {
  margin: 10px 0;
  font-size: 16px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --bg-hover: #374151;
    --bg-selected: #1e3a8a;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --border-color: #374151;
  }
}